package ru.vsu.amm.fuzzy;

/**
 * Класс для вычисления LMIN-, LMAX-операторов. 
 * @author Иванов Илья
 * @since 06 января 2013
 */
public class LMIN_LMAX {
	
	public static Scale calcLMIN(Scale[] weights, Scale[] scores) {
		Scale lmin = Scale.getByIndex(Scale.T);
		for (int i = 0; i < weights.length; i++)
			lmin = Scale.min(lmin, Scale.max(Scale.neg(weights[i]), scores[i]));
		
		return lmin;
	}
	
	public static Scale calcLMAX(Scale[] weights, Scale[] scores) {
		Scale lmax = Scale.getByIndex(0);
		for (int i = 0; i < weights.length; i++)
			lmax = Scale.max(lmax, Scale.min(weights[i], scores[i]));
		
		return lmax;
	}	
}